/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2024-05-20
 * Time: 23:06
 */
class MyRunnable implements Runnable{

    @Override
    public void run() {
        while(true) {
            System.out.println("打印Thread");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class Deom2 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(new MyRunnable());
        t1.start();
        while(true) {
            System.out.println("打印main");
            Thread.sleep(1000);
        }
    }

}
